package com.woniuxy.threeproject.end_water_project_user.exception;

import com.woniuxy.threeproject.end_water_project_user.commons.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class EndWaterProjectUserException {

    @ExceptionHandler(EndWaterRuntimeException.class)
    public Result endWaterRuntimeException(EndWaterRuntimeException e){
        log.info("运行时异常：{}",e.getMessage());
        return Result.fail("3003",e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    public Result exception(Exception e){
        log.info("未知系统异常：{}",e);
        return Result.fail("5005","未知系统异常");
    }

}
